﻿using System.Collections.Generic;
using System.Reflection;
using System.IO;

namespace Moven
{
    static class PredefinedData
    {
#if __IOS__
        const string resourcePrefix = "Moven.iOS.";
#endif
#if __ANDROID__
        const string resourcePrefix = "Moven.Droid.";
#endif
        public const string MovenArticlesKey = "MovenArticles";

        public static readonly Dictionary<string, string> Data = new Dictionary<string, string>();

        static PredefinedData()
        {
            LoadJsonResource("articles.json", "MovenArticles");
        }

        static void LoadJsonResource(string fileName, string key)
        {
            var assembly = typeof(PredefinedData).GetTypeInfo().Assembly;
			var stream = assembly.GetManifestResourceStream(resourcePrefix + fileName);
            using (var reader = new StreamReader(stream))
            {
                var json = reader.ReadToEnd();
                Data.Add(key, json);
            }
        }
   }
}
